﻿using RockBus.DataContracts;
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace RockBus.Transport.Interfaces
{
    [ServiceContract(Namespace = StringConstants.RockBusNamespace, SessionMode = SessionMode.Allowed)]
    public interface ITwoWay
    {
        [TransactionFlow(TransactionFlowOption.Allowed)]
        [OperationContract(AsyncPattern = true, IsOneWay = false, Action = "*", ReplyAction = "*")]
        IAsyncResult BeginProcessRequest(Message message, AsyncCallback callback, object state);

        Message EndProcessRequest(IAsyncResult result);
    }

    [ServiceContract(Namespace = StringConstants.RockBusNamespace, SessionMode = SessionMode.Allowed)]
    public interface ITwoWayAck
    {
        [TransactionFlow(TransactionFlowOption.Allowed)]
        [OperationContract(AsyncPattern = true, IsOneWay = false, Action = "*", ReplyAction = "*")]
        IAsyncResult BeginProcessRequest(Message message, AsyncCallback callback, object state);

        Message EndProcessRequest(IAsyncResult result);
    }

    [ServiceContract(Namespace = StringConstants.RockBusNamespace, SessionMode = SessionMode.Allowed)]
    public interface ITwoWayTxn
    {
        [TransactionFlow(TransactionFlowOption.Allowed)]
        [OperationContract(AsyncPattern = true, IsOneWay = false, Action = "*", ReplyAction = "*")]
        IAsyncResult BeginProcessRequest(Message message, AsyncCallback callback, object state);

        Message EndProcessRequest(IAsyncResult result);
    }

    [ServiceContract(Namespace = StringConstants.RockBusNamespace, SessionMode = SessionMode.Allowed)]
    public interface ITwoWaySync
    {
        [TransactionFlow(TransactionFlowOption.Allowed)]
        [OperationContract(IsOneWay = false, Action = "*", ReplyAction = "*")]
        Message ProcessRequest(Message message);
    }
}